package cn.yunhe.biz;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import cn.yunhe.dao.IBoardDao;
import cn.yunhe.model.Board;
import cn.yunhe.util.SqlSessionFactoryUtil;

public class BoardBiz {
	SqlSession session = null;

	public List<Board> searchAll() {
		session = SqlSessionFactoryUtil.getSession();
		IBoardDao boardDao = session.getMapper(IBoardDao.class);
		List<Board> list = boardDao.searchAll();
		return list;
	}

	public List<Board> searchByPage(int currPage, int pageSize) {
		session = SqlSessionFactoryUtil.getSession();
		IBoardDao boardDao = session.getMapper(IBoardDao.class);
		List<Board> list = boardDao.searchBoardByPage(currPage, pageSize);
		return list;
	}

	public int getCount() {
		session = SqlSessionFactoryUtil.getSession();
		IBoardDao boardDao = session.getMapper(IBoardDao.class);
		int count = boardDao.getBoardCount();
		return count;

	}

}
